var util = require("./utils/util.js")
//app.js
App({
  onLaunch: function () {
    wx.getUserInfo({
      success: res => {
        console.log(res.userInfo)
      },
      fail: err => {
        wx.reLaunch({
          url: '/pages/index/uinfo'
        })
      }
    })
  },
  //底部导航
  Navigation: function (event, that) {
    var navArr = ['', '/pages/index/index','/pages/cart/index','/pages/myorder/index','/pages/user/index']
    var navIndex = event.currentTarget.dataset.id
    var link = navArr[navIndex];
    if (navIndex==2) {
      wx.navigateTo({
        url: link,
      })
    } else {
      wx.redirectTo({
        url: link,
      })
    }
    
  },
})
